//
//  HomeTableViewCell.m
//  LOL
//
//  Created by lanou3g on 15/11/18.
//  Copyright © 2015年 syx. All rights reserved.
//

#import "HomeTableViewCell.h"
#import <UIImageView+WebCache.h>
#import "HomeTableModel.h"

@interface HomeTableViewCell ()

@property (nonatomic,strong) UIImageView * groyBackView;
@property (nonatomic,strong) UIImageView * whiteBackView;
@property (nonatomic,strong) UIImageView * titleImageView;
@property (nonatomic,strong) UILabel * titleLabel;
@property (nonatomic,strong) UILabel * descLabel;
@property (nonatomic,strong) UILabel * dateLabel;
@property (nonatomic,strong) UILabel * viewnumLabel;
@property (nonatomic,strong) UIImageView * timeImage;
@end

@implementation HomeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupSubViews];
    }
    return self;
}

- (void)setupSubViews{
    
    self.groyBackView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, 135)];
    self.groyBackView.backgroundColor = [UIColor groupTableViewBackgroundColor];
    [self.contentView addSubview:self.groyBackView];
    
    self.whiteBackView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 0, [UIScreen mainScreen].bounds.size.width - 10, 130)];
    self.whiteBackView.backgroundColor = [UIColor whiteColor];
    self.whiteBackView.layer.cornerRadius = 5;
    [self.groyBackView addSubview:self.whiteBackView];
    
    self.titleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(5, 5, 90, 90)];
    [self.whiteBackView addSubview:self.titleImageView];

    self.titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 0, self.whiteBackView.frame.size.width - 110, 55)];
    self.titleLabel.numberOfLines = 0;
    self.titleLabel.font = [UIFont systemFontOfSize:16];
    [self.whiteBackView addSubview:self.titleLabel];
    
    self.descLabel = [[UILabel alloc]initWithFrame:CGRectMake(100, 55, self.whiteBackView.frame.size.width  - 110, 45)];
    self.descLabel.numberOfLines = 0;
    self.descLabel.font = [UIFont systemFontOfSize:15];
    self.descLabel.textColor = [UIColor lightGrayColor];
    [self.whiteBackView addSubview:self.descLabel];
    
    self.timeImage = [[UIImageView alloc]initWithFrame:CGRectMake(100, 108, 18, 18)];
    self.timeImage.image = [UIImage imageNamed:@"Time"];
    [self.whiteBackView addSubview:self.timeImage];
    
    self.dateLabel = [[UILabel alloc]initWithFrame:CGRectMake(130, 110, 80, 20)];
    self.dateLabel.font = [UIFont systemFontOfSize:14];
    self.dateLabel.textColor = [UIColor lightGrayColor];
    [self.whiteBackView addSubview:self.dateLabel];

}

-(void)setupViewsWithModel:(HomeTableModel *)homeModel{

    [self.titleImageView sd_setImageWithURL:[NSURL URLWithString:homeModel.ico] placeholderImage:nil];
    self.titleLabel.text = homeModel.title;
    self.descLabel.text = homeModel.des;
    self.dateLabel.text = homeModel.datetime;
    
}


- (void)awakeFromNib {

    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}


@end
